package by.qizer.android.example.globalweather.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import by.qizer.android.example.globalweather.util.HttpUtil;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		boolean result = true;
		switch (item.getItemId()) {
			case (R.id.menu_action_settings) :
				Intent intent = new Intent(this, PreferenceActivity.class);
				startActivity(intent);
				break;
			case (R.id.menu_action_update) :
				HttpUtil.sentReuqest();
				break;
			default :
				result = false;
		}
		return result;
	}
}
